import loadable from '@/utils/loadable'
import { RouteObject } from 'react-router-dom'
const Login=loadable(()=>import('@/views/Login'))
const Home=loadable(()=>import('@/views/Home'))
const Product=loadable(()=>import('@/views/Product'))
const Category=loadable(()=>import('@/views/Category'))
const Main=loadable(()=>import('@/views/Main'))
const NotFound=loadable(()=>import('@/views/NotFound'))
//定义路由数组
const routes:Array<RouteObject>=[
    {
        path:'/login',
        element:<Login></Login>
    },
    {
        path:'/',
        element:<Home></Home>,
        children:[
            {
               index:true,
               element:<Main></Main> 
            },
            {
                path:'product',
                element:<Product></Product>
            },
            {
                path:'category',
                element:<Category></Category>
            }
        ]
    },
    {
        path:'*',
        element:<NotFound></NotFound>
    }
]
export default routes